home *** CD-ROM | disk | FTP | other *** search
/ Multi Active Maximuzer 3.0is / MultiActive Maximuzer 3.0is.iso / sirnet / scripts.z / CSERVE.SCR < prev    next >
Text File  |  1996-03-22  |  7KB  |  342 lines

  1. !
  2. !  Copyright (c) 1995
  3. !  by CompuServe Incorporated, Columbus, Ohio
  4. !
  5. !  The information in this software is subject to change without
  6. !  notice and should not be construed as a commitment by CompuServe.
  7. !
  8. !  CSERVE:
  9. !    Connect to CIS.
  10. !    First argument is %TRUE if direct connect and %FALSE otherwise
  11. !    Success:  returns %Success
  12. !    Failure:  saves error msg in %FailureMsg and returns %Failure
  13. !        or %Fatal (depending on severity).
  14. !
  15. !+V
  16. ! "3.8"
  17. !-V
  18.  
  19. DirectConnect = Arg1;
  20. Internet = 25;
  21. ifndef %HostName = "CPS";
  22. Wait_Time = 80;
  23. Msg = "Connecting to CompuServe Network";
  24. if %Network <> Internet goto NotInternet;
  25. Msg = "Logging onto CompuServe .    ";
  26. define %HostName = "CISAGREE";
  27. ifndef %Scanned = "";
  28. Wait_Time = 30;
  29.  
  30. NotInternet:
  31. show Msg;
  32. Tries = 7;
  33. FirstTry = %TRUE;
  34. FailStr = "";
  35. Sent_Host_Name = %FALSE;
  36. ifndef %X121Address = "";
  37. ifndef %OKCmd = "";
  38. ifndef %StopAtHost = "";
  39. ifndef %AccountID = "";
  40. ifndef %BreakChar = "#";
  41. ifndef %MicroChallenge = "";
  42. ifndef %App = "";
  43. on cancel goto Return_Cancel;
  44.  
  45. Start_Connect:
  46.     if Tries = 0 goto CIS_Error;
  47.     Tries = Tries - 1;
  48.  
  49. Connect_Wait:
  50.     wait
  51.         "UIC:"        goto Send_ETX,
  52.         "Host Name:"    goto Send_Host_Name,
  53.         "User ID:"    goto Send_ID,
  54.         "Password:"    goto Send_Password,
  55.         "XPAD:"        goto Send_XPAD,
  56.         "ITI:"        goto Send_XPAD,
  57.         "? LOG"        goto Process_Log_Msg,
  58.         "??LOG"        goto Process_Log_Msg,
  59.         "% IPN"        goto Process_IPX_Msg,
  60.         "? IPX"        goto Process_IPX_Msg,
  61.         "? ICD"        goto Process_Net_Msg,
  62.         "??ICD"        goto Process_Net_Msg,
  63.         "RA:"        goto Handle_Secure_Login,
  64.         "0, OFF):"    goto Send_Baud_Rate,
  65.         %mdm_Failure    goto CIS_No_Carrier
  66.     until Wait_Time;
  67.  
  68.     if %Network <> Internet goto Send_Break;
  69.     Wait_Time = 200;
  70.     if not Sent_Host_Name goto Send_CR;
  71.     goto Start_Connect;
  72.  
  73. Send_Break:
  74.     if not DirectConnect goto Send_CR;
  75.     sendm %BreakChar;
  76.     sendm %BreakChar;
  77.     sendm %BreakChar;
  78.  
  79. Send_CR:
  80.     send %CR;
  81.     goto Start_Connect;
  82.  
  83. Send_Baud_Rate:
  84.     send %BaudRate;
  85.     send "^M";
  86.     goto Connect_Wait;
  87.  
  88. Send_ETX:
  89.     send "^C";
  90.     goto Connect_Wait;
  91.  
  92. Send_Host_Name:
  93.     if Arg2 goto No_Wait;
  94.     wait until 10;
  95. No_Wait:
  96.     if Sent_Host_Name goto Reset_Host_Name;
  97.     Sent_Host_Name = %TRUE;
  98.  
  99.     Wait_Time = 200;
  100.     if %StopAtHost = "1" goto Return_Success;
  101.     send %HostName & "^M";
  102.     if %StopAtHost = "" goto Connect_Wait;
  103.     goto Return_Success;
  104.  
  105. !
  106. ! Only send Host Name response on 1st, 3rd, & 5th attempts
  107. ! to guard against unintended double host name prompts resulting
  108. ! from sending "^M".  On even attempts, eat the Host Name: prompt.
  109. !
  110. Reset_Host_Name:
  111.     Sent_Host_Name = %FALSE;
  112.     Tries = Tries - 1;
  113.     goto Connect_Wait;
  114.  
  115. Send_ID:
  116.     if %StopAtHost = "1" goto GetHost;
  117.     define %ErrorCode = 0;
  118.     if %App = "CID" goto No_Msg1;
  119.     show "Logging onto CompuServe . .  ";
  120. No_Msg1:
  121.     if %MicroChallenge = "" goto No_Secure_Login;
  122.  
  123.     send %UserID & %LogonParams & "/INT:60 /secure:1^M";
  124.     goto Connect_Wait;
  125.  
  126. No_Secure_Login:
  127.     send %UserID & %LogonParams & "/INT:60^M";
  128.     goto Connect_Wait;
  129.  
  130. GetHost:
  131.     send "/HOST^M";
  132.     exit %Success;
  133.  
  134. Send_Password:
  135.     send %Password & %CR;
  136.     goto Logon_Wait;
  137.  
  138. Send_XPAD:
  139.     if %X121Address = "" goto Missing_XPAD;
  140.     send %X121Address & %CR;
  141.     goto Connect_Wait;
  142.  
  143. Missing_XPAD:
  144.     define %FailureMsg = "Missing X.121 address";
  145.     define %ErrorCode = 21;
  146.     exit %Fatal;
  147.     
  148. Logon_Wait:
  149.     wait
  150.         "Account ID:"    goto Send_AccountID,
  151.         "CompuServe"    goto Return_Success,
  152.         "^[[>"        goto Return_Success,
  153.         "^F"        goto Return_Success,
  154.         "? LOG"        goto Process_Log_Msg,
  155.         "??LOG"        goto Process_Log_Msg,
  156.         "? IPX"        goto Process_IPX_Msg,
  157.         " NTW"        goto Logon_Failure,
  158.         "? ICD"        goto Process_Net_Msg,
  159.         "??ICD"        goto Process_Net_Msg,
  160.         "800 Direct Dial access " goto Process_800,
  161.         "OK^M"        goto Send_OK_Cmd,
  162.         "^[I"        goto Send_Response,
  163.         "PPP:"        goto Connect_PPP,
  164.         %mdm_Failure    goto CIS_No_Carrier
  165.     until 200;
  166.  
  167.     define %ErrorCode = 22;
  168.     goto CIS_Failure;
  169.  
  170. Connect_PPP:
  171.     if %App <> "CID" goto Logon_Wait;
  172.     define %PPP = "1";
  173.     exit %Success;
  174.         
  175.  
  176. Process_Log_Msg:
  177.     wait
  178.         "INE"    goto Bad_ID,
  179.         "ISX"    goto Bad_ID_Syntax,
  180.         "CAI"    goto Cannot_Auto_Irun,
  181.         "SIL"    goto System_Unavailable,
  182.         "SIU"    goto System_Unavailable,
  183.         "SNA"    goto System_Unavailable,
  184.         "STU"    goto Check_User_ID,
  185.         "INS"    goto Bad_ID_Syntax,
  186.         "UTL"    goto Too_Many_Users
  187.     until 50;
  188.  
  189.     goto Try_Again;
  190.  
  191. Process_IPX_Msg:
  192.     define %ErrorCode = 23;
  193.     define %FailureMsg = "InfoPlex is unavailable, try again later";
  194.     exit %Fatal;
  195.  
  196. Process_Net_Msg:
  197.     define %ErrorCode = 31;
  198.     FailStr = "PPP connection failure, please try again";
  199.  
  200.     wait
  201.         "^M"    goto Found_Error
  202.     until 10;
  203.  
  204.     goto Return_Fail_Msg;
  205.  
  206. Found_Error:
  207.     if %Scanned = "" goto Return_Fail_Msg;
  208.     FailStr = %Scanned;
  209.     goto Return_Fail_Msg;
  210.  
  211. Send_AccountID:
  212.     send %AccountID & %CR;
  213.     goto Logon_Wait;
  214.  
  215. Too_Many_Users:
  216.     if Tries = 0 goto Users_Failure;
  217.     show "Simultaneous users exceeded, retrying...";
  218.     goto Start_Connect;
  219.  
  220. Users_Failure:
  221.     define %FailureMsg = "Simultaneous users exceeded";
  222.     define %ErrorCode = 29;
  223.     exit %Fatal;
  224.  
  225. Cannot_Auto_Irun:
  226.     define %FailureMsg = "Cannot Auto Irun HMI server";
  227.     exit %Fatal;
  228.  
  229. Bad_ID:
  230.     define %ErrorCode = 24;
  231.     FailStr = "Incorrect User ID or password";
  232.     goto Try_Again;
  233.  
  234. Bad_ID_Syntax:
  235.     define %ErrorCode = 25;
  236.     FailStr = "Incorrect User ID syntax";
  237.     goto Try_Again;
  238.  
  239. System_Unavailable:
  240.     define %ErrorCode = 23;
  241.     define %FailureMsg = "The system is unavailable, try again later";
  242.     exit %Fatal;
  243.  
  244. Check_User_ID:
  245.     define %ErrorCode = 26;
  246.     define %FailureMsg = "The system is unavailable, check User ID";
  247.     exit %Fatal;
  248.  
  249. Process_800:
  250.     wait
  251.         "is not" goto No_800,
  252.         "rates" goto Access_Rates
  253.     until 20;
  254.     goto Logon_Wait;
  255.  
  256.  
  257. No_800:
  258.     define %FailureMsg = "800 Direct Dial access is not available on your account";
  259.     define %ErrorCode = 4;
  260.     exit %Fatal;
  261.  
  262. Access_Rates:
  263.     show "800 Direct Dial access rates now in effect";
  264.     goto Logon_Wait;
  265.  
  266. Try_Again:
  267.     if not FirstTry goto CIS_Fatal;
  268.     send "^C";
  269.     FirstTry = %FALSE;
  270.  
  271.     wait
  272.         "User ID"    goto Send_ID,
  273.         %mdm_Failure    goto CIS_No_Carrier
  274.     until 140;
  275.  
  276.     goto CIS_Fatal;
  277.  
  278. Logon_Failure:
  279.     define %ErrorCode = 27;
  280.     define %FailureMsg = "Remote is busy or unavailable";
  281.     exit %Fatal;
  282.  
  283. Send_OK_Cmd:
  284.     if %OKCmd = "" goto Logon_Wait;
  285.     send %OKCmd & %CR;
  286.     goto Logon_Wait;
  287.  
  288. Send_Response:
  289.     sendi %ESCIResponse;
  290.     exit %Success;
  291.  
  292. CIS_Error:
  293.     define %ErrorCode = 20;
  294. CIS_Failure:
  295.     if FailStr <> "" goto Return_Fail_Msg;
  296.     define %FailureMsg = "Unable to connect to CompuServe host";
  297.     exit %Failure;
  298.  
  299. CIS_No_Carrier:
  300.     define %ErrorCode = 28;
  301.     if FailStr <> "" goto Return_Fail_Msg;
  302.     define %FailureMsg = "Modem connection lost";
  303.     exit %Failure;
  304.  
  305. CIS_Fatal:
  306.     if FailStr <> "" goto Return_Fatal_Msg;
  307.     define %FailureMsg = "Unable to connect to CompuServe host";
  308.     exit %Fatal;
  309.  
  310. Return_Fail_Msg:
  311.     define %FailureMsg = FailStr;
  312.     exit %Failure;
  313.  
  314. Return_Fatal_Msg:
  315.     define %FailureMsg = FailStr;
  316.     exit %Fatal;
  317.  
  318. Return_Success:
  319.     exit %Success;
  320.  
  321. Return_Cancel:
  322.     exit %Cancel;
  323.  
  324.  
  325. Handle_Secure_Login:
  326.     if %MicroChallenge = "" goto Connect_Wait;
  327.  
  328.     call %Dir & "seclog.scr" () : FailCode;
  329.  
  330.     if FailCode = %Success goto Logon_Wait;
  331.     if FailCode = %Cancel goto Return_Cancel;
  332.  
  333.     ! Failure condition.
  334.     FailStr = %SecFailTemp;
  335.     if Tries = 0 goto Secure_Connect_Failed;
  336.  
  337.     show %SecFailTemp & ", retrying...";
  338.     goto Start_Connect;
  339.  
  340. Secure_Connect_Failed:
  341.     goto CIS_Failure;
  342.